import 'package:taonile/generated/json/base/json_field.dart';
import 'package:taonile/generated/json/shopping_car_list_entity.g.dart';
import 'dart:convert';

@JsonSerializable()
class ShoppingCarListEntity {
  late int code;
  late String msg;
  late List<ShoppingCarListData> data;

  ShoppingCarListEntity();

  factory ShoppingCarListEntity.fromJson(Map<String, dynamic> json) =>
      $ShoppingCarListEntityFromJson(json);

  Map<String, dynamic> toJson() => $ShoppingCarListEntityToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class ShoppingCarListData {
  @JSONField(name: "store_id")
  late String storeId;

  @JSONField(name: "store_express_money")
  late String storeExpressMoney;

  @JSONField(name: "store_base_name")
  late String storeBaseName;

  @JSONField(name: "store_logo")
  late String storeLogo;


  @JSONField(name: "goods_data")
  late List<ShoppingCarListDataGoodsData> goodsData;
  late bool isCheck = false;

  ShoppingCarListData();

  factory ShoppingCarListData.fromJson(Map<String, dynamic> json) =>
      $ShoppingCarListDataFromJson(json);

  Map<String, dynamic> toJson() => $ShoppingCarListDataToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class ShoppingCarListDataGoodsData {
  @JSONField(name: "business_cart_id")
  late String businessCartId;
  @JSONField(name: "goods_id")
  late String goodsId;
  @JSONField(name: "sku_id")
  late String skuId;
  late String num;
  @JSONField(name: "shop_goods_name")
  late String shopGoodsName;
  @JSONField(name: "main_img")
  late String mainImg;
  @JSONField(name: "img_path")
  late String imgPath;

  late String price;
  @JSONField(name: "sku_data")
  late List<ShoppingCarListDataGoodsDataSkuData> skuData;

  late bool isCheck = false;

  ShoppingCarListDataGoodsData();

  factory ShoppingCarListDataGoodsData.fromJson(Map<String, dynamic> json) =>
      $ShoppingCarListDataGoodsDataFromJson(json);

  Map<String, dynamic> toJson() => $ShoppingCarListDataGoodsDataToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class ShoppingCarListDataGoodsDataSkuData {
  @JSONField(name: "sku_key")
  late String skuKey;
  @JSONField(name: "sku_val")
  late String skuVal;

  ShoppingCarListDataGoodsDataSkuData();

  factory ShoppingCarListDataGoodsDataSkuData.fromJson(Map<String, dynamic> json) =>
      $ShoppingCarListDataGoodsDataSkuDataFromJson(json);

  Map<String, dynamic> toJson() => $ShoppingCarListDataGoodsDataSkuDataToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}
